﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nav_list.aspx.cs" Inherits="ByteSite.Web.admin.settings.nav_list" ValidateRequest="false" %>
<%@ Import namespace="ByteSite.Common" %>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>后台导航管理</title>
<link rel="stylesheet" type="text/css" href="../../scripts/artdialog/ui-dialog.css" />

<link rel="stylesheet" type="text/css" href="../skin/default/style.css" />
<link href="../skin/uikit/css/uikit.min.css" rel="stylesheet" />
<script type="text/javascript" src="../skin/uikit/js/uikit.min.js"></script>
<script type="text/javascript" src="../skin/uikit/js/uikit-icons.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="../../scripts/artdialog/dialog-plus-min.js"></script>
<script type="text/javascript" src="../../scripts/xm-select/xm-select.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
<style type="text/css">
    .layer {
    display:inline-block;
    }
    .layer-2 {
        width:15px;
    }
    .layer-3 {
        width:30px;
    }
    .layer-4 {
        width:45px;
    }
    .layer-5 {
        width:60px;
    }
    .layer-6 {
        width:75px;
    }
    .layer-7 {
        width:90px;
    }
    .layer-8 {
        width:105px;
    }
    .layer-9 {
        width:120px;
    }
    .layer-10 {
        width:135px;
    }
</style>
<script type="text/javascript">
    $(function () {

    });
    function toggleChildren(id) {
        console.log($("#toggle-" + id).attr("class"));
        if ($("#toggle-" + id).hasClass("uk-icon-down")) {
            $("#list tbody tr").each(function (index, obj) {
                console.log(index);
                if ($(this).attr("parent") == id) {
                    $(this).hide();
                }
            })
            $("#toggle-" + id).removeClass("uk-icon-down").addClass("uk-icon-right");
            $("#toggle-" + id).attr("uk-icon", "chevron-right");
        } else if ($("#toggle-" + id).hasClass("uk-icon-right")) {
            $("#list tbody tr").each(function (index, obj) {
                console.log(index);
                if ($(this).attr("parent") == id) {
                    $(this).show();
                }
            })
            $("#toggle-" + id).removeClass("uk-icon-right").addClass("uk-icon-down");
            $("#toggle-" + id).attr("uk-icon", "chevron-down");
        }
    }
</script>
</head>

<body class="mainbody">
<form id="form1" runat="server">


<!--工具栏-->
<div class="uk-grid-match uk-child-width-auto uk-flex-between uk-grid">
    <div class="uk-first-column">
        <div class="uk-panel">
            <div class="uk-button-group uk-first-column">
                <a class="uk-button uk-button-default" uk-icon="check" href="javascript:;" onclick="checkAll(this);" uk-tooltip="全选"></a>
                <a class="uk-button uk-button-default" uk-icon="plus" href="nav_edit.aspx?action=<%=DTEnums.ActionEnum.Add %>" uk-tooltip="新增"></a>
                <asp:LinkButton ID="btnSave" runat="server" uk-icon="cloud-upload" CssClass="uk-button uk-button-default" onclick="btnSave_Click" uk-tooltip="保存"></asp:LinkButton>
                <asp:LinkButton ID="btnDelete" runat="server" uk-icon="trash" CssClass="uk-button uk-button-default" OnClientClick="return ExePostBack('btnDelete','本操作会删除本导航及下属子导航，是否继续?');" onclick="btnDelete_Click" uk-tooltip="删除"></asp:LinkButton>
            </div>
        </div>
    </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="uk-overflow-auto">
    <table id="list" class="uk-table uk-table-striped uk-table-hover uk-table-middle uk-table-divider">
        <thead>
            <tr>
                <th class="uk-table-shrink"></th>
                <th class="uk-table-expand uk-text-left">标题</th>
                <th class="uk-width-expand uk-text-left">调用别名</th>
                <th class="uk-table-expand uk-width-medium">显示</th>
                <th class="uk-table-expand uk-width-medium">默认</th>
                <th class="uk-width-medium">排序</th>
                <th class="uk-table-expand">操作</th>
            </tr>
        </thead>
        <tbody>
             <asp:Repeater ID="rptList" runat="server">
            <ItemTemplate>
            <tr parent="<%#Eval("parent_id")%>">
                <td>
                    <asp:CheckBox ID="chkId" CssClass="uk-checkbox" runat="server" Enabled='<%#bool.Parse((Convert.ToInt32(Eval("is_sys"))==0 ).ToString())%>' />
                    <asp:HiddenField ID="hidId" Value='<%#Eval("id")%>' runat="server" />
                </td>
                <td class="uk-text-left">
                    <span class="layer layer-<%#Eval("class_layer")%>"></span>
                    <a id="toggle-<%#Eval("id")%>" class="uk-icon-down" uk-icon="chevron-down" onclick="toggleChildren('<%#Eval("id")%>')"></a>
                    <%#Eval("title")%>
                </td>
                <td class="uk-text-left">
                    <a class="uk-link-text" href="nav_edit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("id")%>"><%#Eval("name")%></a>
                    <%#Eval("link_url").ToString() == "" ? "" : "(链接：" + Eval("link_url") + ")"%>
                </td>
                <td>
                    <%#Convert.ToInt32(Eval("is_lock")) == 0 ? "<span uk-icon='check'></span>" : "<span uk-icon='icon:close; ratio:0.8'></span>"%>
                </td>
                <td>
                    <%#Convert.ToInt32(Eval("is_sys")) == 1 ? "<span uk-icon='check'></span>" : "<span uk-icon='icon:close; ratio:0.8'></span>"%>
                </td>
                <td>
                    <asp:TextBox ID="txtSortId" runat="server" Text='<%#Eval("sort_id")%>' CssClass="uk-input uk-form-small uk-form-width-xsmall" onkeydown="return checkNumber(event);" />
                </td>
                <td>            
                    <a href="nav_edit.aspx?action=<%#DTEnums.ActionEnum.Add %>&id=<%#Eval("id")%>">添子级</a>
                    <a href="nav_edit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("id")%>">修改</a>
                </td>
            </tr>
            </ItemTemplate>
            </asp:Repeater>
        </tbody>
    </table>
</div>
<!--/列表-->

</form>
</body>
</html>
